package com.wwmz.iterator.pattern.course;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wumz on 2020/9/22 16:11
 */
public class CourseAggregateImpl implements ICourseAggregate {

    private List courseList;

    public CourseAggregateImpl(List courseList) {
        this.courseList = new ArrayList();
    }

    public CourseAggregateImpl() {
    }

    @Override
    public void add(Course course) {
        courseList.add(course);
    }

    @Override
    public void remove(Course course) {
        courseList.remove(course);
    }

    @Override
    public Iterator<Course> iterator() {
        return new IteratorImpl<Course>(courseList);
    }
}
